/*
 * Copyright (C) 2005, Velocityme Partnership
 * LicenceKeySingleUsername.java
 *
 * Created on 21 June 2005, 05:46
 */

package com.velocityme.utility;

import java.util.Date;

/**
 *
 * @author  Robert
 */
public class LicenceKeySingleUsername extends LicenceKey {
    
    private String m_username;
    
    /** Creates a new instance of LicenceKeySingleUsername */
    public LicenceKeySingleUsername(Date p_expiryDate, String p_clientGUID, String p_username) {
        super(p_expiryDate, p_clientGUID);
        m_username = p_username;
    }
    
    public LicenceKeySingleUsername() {
    }
    
    public String getUsername() { return m_username; }
    public void setUsername(String p_username) { m_username = p_username; }
    
    public String toString() {
        return "Single user: " + m_username;
    }
    
    public boolean addNewSession(int p_numCurrentSessions, String p_username) {
        return isValid() && p_numCurrentSessions == 0 && p_username.equals(m_username);
    }
    
}
